//
//  BCOrderNewCollectionViewCell.m
//  BangcaiSale
//
//  Created by Liang Zhang on 16/7/7.
//  Copyright © 2016年 Bangcai. All rights reserved.
//

#import "BCOrderNewCollectionViewCell.h"

@implementation BCOrderNewCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    //临时数据
    NSString *stuffName = @"芥蓝";
    NSString *stuffCount = @"15";
    
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.stuffTitleLable.text];
    UIColor *textColor = [UIColor colorWithRed:0.933 green:0.310 blue:0.247 alpha:1.000];
    NSString *stuffNameString = [NSString stringWithFormat:@"%@等",stuffName];
    [attributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:[UIColor darkTextColor]
                                range:NSMakeRange(0, stuffNameString.length)];
    [attributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:textColor
                                range:NSMakeRange(stuffNameString.length, stuffCount.length)];
    [attributedString addAttribute:NSForegroundColorAttributeName  //文字颜色
                                value:[UIColor darkTextColor]
                                range:NSMakeRange(stuffNameString.length+stuffCount.length, @"种商品".length)];
    self.stuffTitleLable.attributedText = attributedString;
}

+ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView {
    static NSString *ID = @"OrderNewCellIdentifer";
    UINib *nib = [UINib nibWithNibName:@"BCOrderNewCollectionViewCell" bundle: [NSBundle mainBundle]];
    [collectionView registerNib:nib forCellWithReuseIdentifier:ID];
    BCOrderNewCollectionViewCell *cell = [[BCOrderNewCollectionViewCell alloc] init];
    return cell;
}

@end
